
package com.heima.controller;

import com.heima.domain.pojo.LoginInfo;

import com.heima.domain.pojo.User;

import com.heima.response.Result;
import com.heima.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/login")
    @Operation(description = "登录")
    public Result login(@RequestBody User user){
        LoginInfo info = userService.login(user);
        if (info !=null){
            return Result.ok(info);
        }
        return Result.resp("用户名或者密码错误111");
    }


}